|
|
|
|
|
|
|
The TableDef object has three collections: |
|
|
|
|
|
|
|
|
· Fields is the collection that contains all the information about the database fields defined for the TableDef object. This is the default object. |
|
|
|
|
|
|
|
|
· Indexes is the collection that contains all the information about the database indexes defined for the TableDef object. |
|
|
|
|
|
|
|
|
· Properties is the collection that contains all the information about the current TableDef object. |
|
|
|
|
|
|
|
|
Details of the Field and Index objects are covered later in this chapter. |
|
|
|
|
|
|
|
|
The CreateTableDef Method and the TableDef Properties |
|
|
|
|
|
|
|
|
The TableDef properties are set when the table is created. The values of the properties differ depending on whether the TableDef object is a native Microsoft Jet object or an attached object. Listing 9.14 shows the properties of a native Microsoft Jet TableDef object. |
|
|
|
|
|
|
|
|
Add another button to the project. Set its Name property to cmdTableDef and its Caption property to TableDef. Add the code in Listing 9.14 to the cmdTableDef_Click event. |
|
|
|
|
|
|
|
|
Listing 9.14. Adding the TableDef button. |
|
|
|
|
|
|
|
|
Private Sub cmdTableDef_Click()
'
' show tabledef properties
'
On Error GoTo LocalErr
'
Dim ws As Workspace
Dim db As Database
Dim td As TableDef
Dim pr As Property
'
Dim strDBName As String
Dim strTDName As String
Dim strMsg As String
'
' init vars
strDBName = App.Path & "\..\..\data\books5.mdb"
strTDName = "NewTable"
'
' open ws and db
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase(strDBName)
' |
|
|
|
|
|